package com.example.springsecuritydemo.controller;


import com.example.springsecuritydemo.pojo.User;
import com.example.springsecuritydemo.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/user")
public class SecurityController {

    @Autowired
    private IUserService userService;

    @RequestMapping(value = "findAll", method = RequestMethod.GET)
    public List<User> findAll(){
        List<User> list = userService.list();
        return list;
    }
}
